package com.practise.coffee.dao;

import com.practise.coffee.entity.coffee.TargetCoffee;
import com.practise.coffee.entity.other.ExtentMaterial;
import com.practise.coffee.entity.other.Milk;
import com.practise.coffee.entity.other.Suger;
import com.practise.coffee.enums.CoffeeType;
import com.practise.coffee.exceptions.BusException;

/**
 * 摩卡咖啡制作
 *
 * @author:lhz
 * @date:2019/2/18 10:03
 */
public class MochaMakeDaoImpl implements MakeDao {
	@Override
	public CoffeeType type() {
		return CoffeeType.MOCHA;
	}

	@Override
	public void pouringCoffeePowder() {
		System.out.println("加入摩卡咖啡粉成功");
	}

	@Override
	public void pouringWater(int degree) {
		if(degree < 50){
			throw new BusException("水温不够！至少50度");
		}
		System.out.println("加水成功，水温：" + degree);
	}

	@Override
	public void stiring() {
		System.out.println("搅拌成功");
	}

	@Override
	public void freeze() {

		System.out.println("冰冻");
	}

	@Override
	public void flushFlower() {

		System.out.println("拉花成功");
	}

	@Override
	public <T extends ExtentMaterial> void addMaterial(T t) {
		if (t instanceof Suger) {
			System.out.println("Suger");
		}
		if (t instanceof Milk) {
			System.out.println("Milk");
		}
	}

	@Override
	public TargetCoffee makeSuccess() {
		TargetCoffee tc=	new TargetCoffee();
		tc.setCoffeeType(CoffeeType.MOCHA);
		tc.setCreatTime(System.currentTimeMillis());
		tc.setPrice(10.);
		tc.setName("现磨摩卡咖啡");
		return tc;
	}

	@Override
	public void sell() {

	}
}
